<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>8-const常量定义</title>
</head>
<body>
    <script>
        const cates = [{username:'李宝莉'}];
        //1.声明常量必须赋值
        const PI=3.14;
        //2.常量具有块级作用域
        if(true){
            const x = 20;
        }
        //console.log(x);//x is not defined

        //3.常量赋值以后不能进行更改
        const city = '西安';
        //city = '北京';//invalid assignment to const 'city'

        const citys = ['西安','上海','北京'];
        //citys = ['成都','太原','厦门'];//invalid assignment to const 'citys'
        citys[0] = '成都';
        citys[1] = '太原';
        citys[2] = '厦门';
        console.log(citys);



    </script>
</body>
</html>